package com.isoftstone;

import com.isoftstone.framework.druid.InitDataSource;
import com.isoftstone.common.utils.SpringContext;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;

@Configuration
@ServletComponentScan
@SpringBootApplication
@EnableScheduling
@MapperScan("com.isoftstone.project.**.**.mapper")
@Slf4j
public class MainApplication extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {

		return application.sources(MainApplication.class);
	}

	public static void main(String[] args){

		SpringApplication.run(MainApplication.class, args);
		InitDataSource initDataSource = (InitDataSource) SpringContext.getBean("initDataSource");
		initDataSource.init();

	}




}
